<!DOCTYPE html>
<html lang="zh">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/header :: header(~{::title},~{::link},~{})">
    <title>点餐</title>
    <link rel="icon" th:href="@{/assets/img/lcxm.ico}" type="image/ico">
</head>
<body class="body">
<!--导航-->
<div th:replace="common/nav :: nav(true)"></div>

<div class="container">

    <div class="row">
        <div style="margin-top: 20px;"></div>
        <div class="row">

            <form class="form-horizontal validate" role="form" method="post" th:action="@{/order/save}"
                  onsubmit="return checkForm(this);">

                <!-- 操作信息提示的地方 -->
                <div th:if="${remind}" class="alert alert-${ remind.level  }"
                     th:classappend="'alert-' + ${remind.level}">
                    <button data-dismiss="alert" class="close" type="button">
                        <i class="glyphicon glyphicon-remove"></i>
                    </button>
                    <span th:remove="tag" th:utext="${ remind.message }"></span>
                </div>

                <div class="hidden">
                    <input type="text" name="startId" th:value="${startId}">
                    <input type="text" name="id" th:value="${id}">
                </div>


                <div class="alert " th:each="cur:${orders}"
                     th:classappend="${cur.isSelected()? 'alert-warning' : 'alert-danger'}">
                    <div class="radio">
                        <label>
                            <input type="radio" name="packageId" id="" th:value="${cur.code}"
                                   th:checked="${cur.isSelected()}">
                            [[${cur.text}]]
                        </label>

                    </div>
                </div>

                <hr/>

                <div class="form-group clearfix">
                    <div class="text-center col-sm-9">

                        <button th:if="${remind == null}" type="submit" class="btn btn-lg btn-primary">
                            <i class="glyphicon glyphicon-ok"></i> 提交
                        </button>
                        <button th:if="${id}" type="button" class="btn btn-lg  btn-danger action-get"
                                th:attrappend="data-url='/order/cancle/'+${id}"
                                data-confirm="确定取消点餐吗"
                        >

                            <i class="glyphicon glyphicon-remove"></i> 取消点餐
                        </button>
                        <a type="button" class="btn btn-lg  btn-info" th:href="@{/order/list}">
                            <i class="glyphicon glyphicon-repeat"></i> 返回
                        </a>
                    </div>
                </div>

            </form>


        </div>


    </div>
</div>

<!-- 引入通用js-->
<div th:replace="common/footer :: footer"></div>
<script>
    function checkForm(form) {
        var $form = $(form);
        var size = $("input[name=packageId]").filter(":checked").size();
        if (size > 0) {
            return true;
        }
        $.alert({
            theme: 'bootstrap',
            title: '温馨提示',
            content: '请选择要点的套餐'
        });
        return false;
    };
</script>

</body>
</html>